﻿using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB;
using YArchitech.LIB;
using YArchitech.Revit;

namespace HYFloorPipeModule
{
	public class DrpgDrawManager
	{
		public DrpgDrawManager(XYZ ptTL, XYZ ptTR, XYZ ptBR, DrawFloorPipeData drawFPData)
		{
			this.ReInitBorder(ptTL, ptTR, ptBR);
			this.drawFpData = drawFPData;
			this.Set_DataClear();
		}

		public void Set_DataClear()
		{
			this.m_aryLines = this.InitLst<Line>(this.m_aryLines);
			this.m_aryArcs = this.InitLst<Arc>(this.m_aryArcs);
			this.m_aryArcPts = this.InitLst<ArcPtPair>(this.m_aryArcPts);
			this.m_aryArcPtsIn = this.InitLst<ArcPtPair>(this.m_aryArcPtsIn);
			this.m_aryArcPtsOut = this.InitLst<ArcPtPair>(this.m_aryArcPtsOut);
			this.m_aryLinePtsLeft = this.InitLst<PointPair>(this.m_aryLinePtsLeft);
			this.m_aryLinePtsRight = this.InitLst<PointPair>(this.m_aryLinePtsRight);
			this.m_aryLinePtsTop = this.InitLst<PointPair>(this.m_aryLinePtsTop);
			this.m_aryLinePtsBot = this.InitLst<PointPair>(this.m_aryLinePtsBot);
		}

		private List<T> InitLst<T>(List<T> list)
		{
			list = (list ?? new List<T>());
			list.Clear();
			return list;
		}

		private void ReInitBorder(XYZ ptTL, XYZ ptTR, XYZ ptBR)
		{
			XYZ xyz = (ptTR - ptTL).Normalize();
			ptTR = Line.CreateUnbound(ptTL, xyz).Project(ptBR).XYZPoint;
			Line line = Line.CreateUnbound(ptBR, xyz);
			this.m_ptTL = ptTL;
			this.m_ptBL = line.Project(ptTL).XYZPoint;
			this.m_dWidth = ptTR.DistanceTo(ptTL);
			this.m_dHeight = ptTL.DistanceTo(this.m_ptBL);
			this.m_vWidth = (ptTR - ptTL).Normalize();
			this.m_vHeight = (ptBR - ptTR).Normalize();
		}

		public double GetAllCurveLength()
		{
			double num = 0.0;
			for (int i = 0; i < this.m_aryLines.Count<Line>(); i++)
			{
				double length = this.m_aryLines.ElementAt(i).Length;
				num += length;
			}
			for (int i = 0; i < this.m_aryArcs.Count<Arc>(); i++)
			{
				double length2 = this.m_aryArcs.ElementAt(i).Length;
				num += length2;
			}
			return num * 304.8 / 1000.0;
		}

		public bool DispatchRegion()
		{
			switch (this.drawFpData.PipeStyle)
			{
			case FloorPipeStyle.STYLE_HUIZHUAN:
				if (!this.DispatchRegion_HZ())
				{
					return false;
				}
				this._Connect_HZ();
				break;
			case FloorPipeStyle.STYLE_ZHILIE:
			{
				double num = this.drawFpData.DisToWall + Math.Min(this.drawFpData.DisRadius, this.drawFpData.DisA / 2.0);
				double dBotOff = num + this.drawFpData.DisB;
				double disRadius = this.drawFpData.DisRadius;
				if (!this.DispatchRegion_PX(num, dBotOff, this.drawFpData.DisB, disRadius))
				{
					return false;
				}
				this._Connect_PX();
				break;
			}
			case FloorPipeStyle.STYLE_WANGFU:
			{
				double num2 = this.drawFpData.DisToWall + this.drawFpData.DisB + Math.Min(this.drawFpData.DisRadius, 3.0 * this.drawFpData.DisA / 2.0);
				double disRadius2 = this.drawFpData.DisRadius;
				double disB = this.drawFpData.DisB;
				if (!this.DispatchRegion_PX(num2, num2, disB, disRadius2))
				{
					return false;
				}
				this._Connect_DPX();
				break;
			}
			case FloorPipeStyle.STYLE_KUAYUE:
				if (!this.DispatchRegion_KY())
				{
					return false;
				}
				this._Connect_KY();
				break;
			case FloorPipeStyle.STYLE_DANHUIZHUAN:
				if (!this.DispatchRegion_SHZ())
				{
					return false;
				}
				this._Connect_SHZ();
				break;
			}
			return true;
		}

		private bool DispatchRegion_PX(double dTopOff, double dBotOff, double dMinDB, double dMaxRadius)
		{
			if (this.m_dHeight < 2.0 * this.drawFpData.DisToWall + Math.Min(this.drawFpData.DisB, dMinDB) + 2.0 * Math.Max(this.drawFpData.DisRadius, dMaxRadius))
			{
				return false;
			}
			if (this.m_dWidth < this.drawFpData.DisToWall + 2.0 * this.drawFpData.BoundLeftDis + this.drawFpData.DisB)
			{
				return false;
			}
			if (Math.Min(dTopOff, dBotOff) > this.m_dHeight)
			{
				return false;
			}
			XYZ vHeight = this.m_vHeight;
			XYZ vWidth = this.m_vWidth;
			XYZ xyz = vWidth * this.drawFpData.DisToWall;
			XYZ xyz2 = this.m_ptBL - dBotOff * vHeight;
			XYZ xyz3 = this.m_ptTL + dTopOff * vHeight + xyz;
			XYZ xyz4 = xyz2 + xyz;
			this.m_aryLinePtsLeft.Add(new PointPair(xyz4, xyz3, true, false));
			double num = this.drawFpData.DisToWall + this.drawFpData.BoundLeftDis;
			double dWidth = this.m_dWidth;
			while (num < dWidth)
			{
				XYZ xyz5 = xyz3;
				if (num < this.drawFpData.BoundLeftWidth)
				{
					num += this.drawFpData.BoundLeftDis;
					xyz3 = xyz4 + vWidth * this.drawFpData.BoundLeftDis;
					xyz4 = xyz5 + vWidth * this.drawFpData.BoundLeftDis;
				}
				else if (num > dWidth - this.drawFpData.BoundRightWidth)
				{
					num += this.drawFpData.BoundRightDis;
					xyz3 = xyz4 + vWidth * this.drawFpData.BoundRightDis;
					xyz4 = xyz5 + vWidth * this.drawFpData.BoundRightDis;
				}
				else
				{
					num += this.drawFpData.DisA;
					xyz3 = xyz4 + vWidth * this.drawFpData.DisA;
					xyz4 = xyz5 + vWidth * this.drawFpData.DisA;
				}
				if (num < dWidth)
				{
					this.m_aryLinePtsLeft.Add(new PointPair(xyz4, xyz3, false, false));
				}
			}
			return true;
		}

		private bool DispatchRegion_HZ()
		{
			if (this.m_dWidth <= 2.0 * this.drawFpData.DisToWall + this.drawFpData.DisA + this.drawFpData.DisC || this.m_dHeight <= 2.0 * this.drawFpData.DisToWall + this.drawFpData.DisB + this.drawFpData.DisD)
			{
				return false;
			}
			double dMinWDist = Math.Max(2.0 * this.drawFpData.DisA + this.drawFpData.DisC, 2.0 * this.drawFpData.DisRadius + Math.Max(this.drawFpData.DisA, this.drawFpData.DisC));
			double dMinHDist = Math.Max(2.0 * this.drawFpData.DisB + this.drawFpData.DisD, 2.0 * this.drawFpData.DisRadius + Math.Max(this.drawFpData.DisB, this.drawFpData.DisD));
			RevolvingEdge revolvingEdge = new RevolvingEdge();
			revolvingEdge.SetIn(true);
			if (revolvingEdge.Create(this.m_ptBL, this.m_vWidth * this.m_dWidth, -this.m_vHeight * this.m_dHeight, this.drawFpData.DisRadius))
			{
				bool flag = revolvingEdge.Offset(this.drawFpData.DisToWall, this.drawFpData.DisToWall, this.drawFpData.DisToWall, this.drawFpData.DisToWall);
				while (flag)
				{
					revolvingEdge.CalAllVertices(2.0 * this.drawFpData.DisA);
					if (!revolvingEdge.CanDraw2(dMinWDist, dMinHDist))
					{
						break;
					}
					flag = revolvingEdge.Offset(2.0 * this.drawFpData.DisA, 2.0 * this.drawFpData.DisB, 2.0 * this.drawFpData.DisC, 2.0 * this.drawFpData.DisD);
				}
				this.m_aryArcPtsIn.AddRange(revolvingEdge.m_arrAllAp);
				this.m_aryLinePtsLeft.AddRange(revolvingEdge.m_arrAllPp);
			}
			this._DealWidth(this.m_aryLinePtsLeft, this.m_aryArcPtsIn, false);
			RevolvingEdge revolvingEdge2 = new RevolvingEdge();
			revolvingEdge2.SetIn(false);
			if (revolvingEdge2.Create(this.m_ptBL, this.m_vWidth * this.m_dWidth, -this.m_vHeight * this.m_dHeight, this.drawFpData.DisRadius))
			{
				bool flag2 = revolvingEdge2.Offset(this.drawFpData.DisToWall + this.drawFpData.DisA, this.drawFpData.DisToWall + this.drawFpData.DisB, this.drawFpData.DisToWall + this.drawFpData.DisC, this.drawFpData.DisToWall + this.drawFpData.DisD);
				while (flag2)
				{
					revolvingEdge2.CalAllVertices(2.0 * this.drawFpData.DisA);
					if (!revolvingEdge2.CanDraw2(dMinWDist, dMinHDist))
					{
						break;
					}
					flag2 = revolvingEdge2.Offset(2.0 * this.drawFpData.DisA, 2.0 * this.drawFpData.DisB, 2.0 * this.drawFpData.DisC, 2.0 * this.drawFpData.DisD);
				}
				this.m_aryArcPtsOut.AddRange(revolvingEdge2.m_arrAllAp);
				this.m_aryLinePtsRight.AddRange(revolvingEdge2.m_arrAllPp);
			}
			this._DealWidth(this.m_aryLinePtsRight, this.m_aryArcPtsOut, false);
			return true;
		}

		private void _Connect_PX()
		{
			if (this.m_aryLinePtsLeft.Count == 0)
			{
				return;
			}
			int num = this.m_aryLinePtsLeft.Count;
			if (num % 2 != 0)
			{
				this.m_aryLinePtsLeft.RemoveAt(num - 1);
				num--;
			}
			if (this.drawFpData.BDrawCenter)
			{
				XYZ vDir = this.CalcMoveDirection(this.m_aryLinePtsLeft.Last<PointPair>());
				this.m_aryLinePtsLeft.ForEach(delegate(PointPair pair)
				{
					pair.Offset(vDir);
				});
			}
			PointPair pointPair = this.m_aryLinePtsLeft[0];
			XYZ vHeight = this.m_vHeight;
			XYZ vWidth = this.m_vWidth;
			XYZ first = this.m_ptBL - (vHeight * this.drawFpData.DisToWall - vWidth * pointPair.DistanceTo(this.m_ptBL));
			pointPair.First = first;
			this.m_aryLinePtsLeft[0] = pointPair;
			for (int i = 0; i < num; i++)
			{
				PointPair pointPair2 = this.m_aryLinePtsLeft[i];
				pointPair2.IsIn = (i < num / 2);
				this.m_aryLinePtsLeft[i] = pointPair2;
			}
			if (num < 2)
			{
				return;
			}
			PointPair pointPair3 = this.m_aryLinePtsLeft[num - 1];
			XYZ xyz = pointPair3.Second;
			xyz += vHeight * this.drawFpData.DisB;
			pointPair3.Second = xyz;
			pointPair3.IsIn = false;
			this.m_aryLinePtsLeft[num - 1] = pointPair3;
			this.MakeArcByPPArray(this.m_aryLinePtsLeft, this.drawFpData.DisRadius);
			double num2 = Math.Min(this.drawFpData.DisRadius, this.drawFpData.DisA / 2.0);
			XYZ xyz2 = this.m_aryLinePtsLeft[1].Second;
			xyz2 += vHeight * (this.drawFpData.DisB + num2);
			XYZ s = xyz + (vHeight - vWidth) * num2;
			this.m_aryLinePtsLeft.Add(new PointPair(xyz2, s, false, false));
			if (this.drawFpData.DisRadius > 0.0)
			{
				XYZ xyz3 = xyz - vWidth * num2;
				XYZ xyz4 = (vWidth + vHeight).Normalize();
				XYZ m = xyz3 + num2 * xyz4;
				this.m_aryArcPts.Add(new ArcPtPair(s, m, xyz, false, false));
			}
		}

		private void _Connect_DPX()
		{
			if (this.m_aryLinePtsLeft.Count == 0)
			{
				return;
			}
			int num = this.m_aryLinePtsLeft.Count;
			if (num % 2 != 0)
			{
				this.m_aryLinePtsLeft.RemoveAt(num - 1);
				num--;
			}
			if (num < 2)
			{
				return;
			}
			if (this.drawFpData.BDrawCenter)
			{
				XYZ vDir = this.CalcMoveDirection(this.m_aryLinePtsLeft.Last<PointPair>());
				this.m_aryLinePtsLeft.ForEach(delegate(PointPair pair)
				{
					pair.Offset(vDir);
				});
			}
			double disToWall = this.drawFpData.DisToWall;
			double num2 = disToWall + Math.Min(this.drawFpData.DisRadius, this.drawFpData.DisA / 2.0);
			double disB = this.drawFpData.DisB;
			XYZ vHeight = this.m_vHeight;
			XYZ vWidth = this.m_vWidth;
			PointPair pointPair = this.m_aryLinePtsLeft[0];
			XYZ second = pointPair.Second;
			XYZ xyz = this.m_ptBL + (-vHeight * disToWall + vWidth * pointPair.DistanceTo(this.m_ptBL));
			pointPair.First = xyz;
			this.m_aryLinePtsLeft[0] = pointPair;
			PointPair pointPair2 = this.m_aryLinePtsLeft[1];
			XYZ first = pointPair2.First;
			XYZ second2 = pointPair2.Second;
			second2 = xyz + (first - second);
			pointPair2.Second = second2;
			this.m_aryLinePtsLeft[1] = pointPair2;
			for (int i = 0; i < num; i++)
			{
				PointPair pointPair3 = this.m_aryLinePtsLeft[i];
				if ((i + 1) % 4 < 2)
				{
					pointPair3.IsIn = true;
				}
				else
				{
					pointPair3.IsIn = false;
					pointPair3.DoExchange();
					this.m_aryLinePtsRight.Add(pointPair3);
				}
			}
			foreach (PointPair item in this.m_aryLinePtsRight)
			{
				this.m_aryLinePtsLeft.Remove(item);
			}
			double num3 = this.drawFpData.DisB - (Math.Min(this.drawFpData.DisRadius, 3.0 * this.drawFpData.DisA / 2.0) - Math.Min(this.drawFpData.DisRadius, this.drawFpData.DisA / 2.0));
			num = this.m_aryLinePtsLeft.Count;
			for (int i = 0; i < num; i++)
			{
				PointPair pointPair4 = this.m_aryLinePtsLeft[i];
				if (i % 2 == 0)
				{
					XYZ xyz2 = pointPair4.Second;
					xyz2 -= vHeight * num3;
					pointPair4.Second = xyz2;
				}
				else
				{
					XYZ xyz2 = pointPair4.First;
					xyz2 -= vHeight * num3;
					pointPair4.First = xyz2;
				}
				this.m_aryLinePtsLeft[i] = pointPair4;
			}
			num = this.m_aryLinePtsRight.Count;
			for (int i = 0; i < num; i++)
			{
				PointPair pointPair5 = this.m_aryLinePtsRight[i];
				if (i != 0)
				{
					if (i % 2 == 0)
					{
						XYZ xyz3 = pointPair5.First;
						xyz3 += vHeight * num3;
						pointPair5.First = xyz3;
					}
					else
					{
						XYZ xyz3 = pointPair5.Second;
						xyz3 += vHeight * num3;
						pointPair5.Second = xyz3;
					}
					this.m_aryLinePtsRight[i] = pointPair5;
				}
			}
			if (num % 2 == 0)
			{
				PointPair pointPair6 = this.m_aryLinePtsLeft[num - 1];
				XYZ xyz4 = pointPair6.Second;
				xyz4 += vHeight * num3;
				pointPair6.Second = xyz4;
				this.m_aryLinePtsLeft[num - 1] = pointPair6;
			}
			else
			{
				PointPair pointPair7 = this.m_aryLinePtsRight[num - 1];
				XYZ xyz5 = pointPair7.Second;
				xyz5 -= vHeight * num3;
				pointPair7.Second = xyz5;
				this.m_aryLinePtsRight[num - 1] = pointPair7;
			}
			double disRadius = this.drawFpData.DisRadius;
			this.MakeArcByPPArray(this.m_aryLinePtsLeft, disRadius);
			this.MakeArcByPPArray(this.m_aryLinePtsRight, disRadius);
			PointPair ppBefore = this.m_aryLinePtsLeft.Last<PointPair>();
			PointPair pointPair8 = this.m_aryLinePtsRight.Last<PointPair>();
			pointPair8.DoExchange();
			this.MakeArcPair(ppBefore, pointPair8, disRadius);
		}

		private bool DispatchRegion_SHZ()
		{
			if (this.m_dWidth <= 2.0 * this.drawFpData.DisToWall + this.drawFpData.DisA + this.drawFpData.DisC || this.m_dHeight <= 2.0 * this.drawFpData.DisToWall + this.drawFpData.DisB + this.drawFpData.DisD)
			{
				return false;
			}
			this.m_aryLinePtsLeft.Clear();
			this.m_aryLinePtsRight.Clear();
			this.m_aryArcPts.Clear();
			double dMinWDist = Math.Max(this.drawFpData.DisA + this.drawFpData.DisC, 2.0 * this.drawFpData.DisRadius + Math.Max(this.drawFpData.DisA, this.drawFpData.DisC));
			double dMinHDist = Math.Max(this.drawFpData.DisB + this.drawFpData.DisD, 2.0 * this.drawFpData.DisRadius + Math.Max(this.drawFpData.DisB, this.drawFpData.DisD));
			RevolvingEdge revolvingEdge = new RevolvingEdge();
			revolvingEdge.SetIn(true);
			if (revolvingEdge.Create(this.m_ptBL, this.m_vWidth * this.m_dWidth, -this.m_vHeight * this.m_dHeight, this.drawFpData.DisRadius))
			{
				bool flag = revolvingEdge.Offset(this.drawFpData.DisToWall, this.drawFpData.DisToWall, this.drawFpData.DisToWall, this.drawFpData.DisToWall);
				while (flag)
				{
					revolvingEdge.CalAllVertices(this.drawFpData.DisA);
					if (!revolvingEdge.CanDraw2(dMinWDist, dMinHDist))
					{
						break;
					}
					flag = revolvingEdge.Offset(this.drawFpData.DisA, this.drawFpData.DisB, this.drawFpData.DisC, this.drawFpData.DisD);
				}
				this.m_aryArcPtsIn.AddRange(revolvingEdge.m_arrAllAp);
				this.m_aryLinePtsLeft.AddRange(revolvingEdge.m_arrAllPp);
			}
			this._DealWidth(this.m_aryLinePtsLeft, this.m_aryArcPts, true);
			return true;
		}

		private bool DispatchRegion_KY()
		{
			if (this.m_dWidth < 2.0 * this.drawFpData.DisToWall + 2.0 * this.drawFpData.DisA)
			{
				return false;
			}
			double num = this.drawFpData.DisToWall + Math.Min(this.drawFpData.DisRadius, this.drawFpData.DisA);
			double num2 = num + this.drawFpData.DisB;
			if (!this.DispatchRegion_PX(num, num, this.drawFpData.DisB, this.drawFpData.DisA))
			{
				return true;
			}
			for (int i = 0; i < this.m_aryLinePtsLeft.Count; i++)
			{
				PointPair pointPair = this.m_aryLinePtsLeft[i];
				if (i % 2 == 0)
				{
					pointPair.IsIn = true;
				}
				else
				{
					pointPair.IsIn = false;
					pointPair.DoExchange();
					this.m_aryLinePtsRight.Add(pointPair);
				}
			}
			foreach (PointPair item in this.m_aryLinePtsRight)
			{
				this.m_aryLinePtsLeft.Remove(item);
			}
			int count = this.m_aryLinePtsRight.Count;
			int count2 = this.m_aryLinePtsLeft.Count;
			if (count > count2)
			{
				this.m_aryLinePtsRight.Remove(this.m_aryLinePtsRight.Last<PointPair>());
			}
			else if (count2 > count)
			{
				this.m_aryLinePtsLeft.Remove(this.m_aryLinePtsLeft.Last<PointPair>());
			}
			if (this.m_aryLinePtsLeft.Count < 2)
			{
				return true;
			}
			XYZ vHeight = this.m_vHeight;
			XYZ vWidth = this.m_vWidth;
			for (int i = 0; i < this.m_aryLinePtsRight.Count; i++)
			{
				PointPair pointPair2 = this.m_aryLinePtsRight[i];
				XYZ xyz = pointPair2.First;
				xyz -= vHeight * (num2 - num);
				XYZ xyz2 = pointPair2.Second;
				xyz2 += vHeight * (num2 - num);
				pointPair2.Reset(xyz, xyz2, false, false);
				this.m_aryLinePtsRight[i] = pointPair2;
			}
			return true;
		}

		private void _Connect_KY()
		{
			if (this.m_aryLinePtsLeft.Count < 2)
			{
				return;
			}
			if (this.drawFpData.BDrawCenter)
			{
				XYZ vDir = this.CalcMoveDirection(this.m_aryLinePtsRight.Last<PointPair>());
				this.m_aryLinePtsLeft.ForEach(delegate(PointPair pair)
				{
					pair.Offset(vDir);
				});
				this.m_aryLinePtsRight.ForEach(delegate(PointPair pair)
				{
					pair.Offset(vDir);
				});
			}
			for (int i = 0; i < this.m_aryLinePtsLeft.Count; i++)
			{
				PointPair pointPair = this.m_aryLinePtsLeft[i];
				PointPair pointPair2 = this.m_aryLinePtsRight[i];
				if (i % 2 != 0)
				{
					pointPair.DoExchange();
					pointPair2.DoExchange();
					this.m_aryLinePtsLeft[i] = pointPair;
					this.m_aryLinePtsRight[i] = pointPair2;
				}
			}
			XYZ vHeight = this.m_vHeight;
			XYZ vWidth = this.m_vWidth;
			PointPair pointPair3 = this.m_aryLinePtsLeft.First<PointPair>();
			XYZ first = pointPair3.First;
			pointPair3.First = first;
			this.m_aryLinePtsLeft[0] = pointPair3;
			PointPair pointPair4 = this.m_aryLinePtsRight.First<PointPair>();
			XYZ xyz = pointPair4.First;
			xyz += vHeight * Math.Max(this.drawFpData.DisRadius, this.drawFpData.DisA);
			pointPair4.First = xyz;
			this.m_aryLinePtsRight[0] = pointPair4;
			PointPair pointPair5 = this.m_aryLinePtsRight.Last<PointPair>();
			XYZ xyz2 = (pointPair5.Second - pointPair5.First).Normalize();
			XYZ xyz3 = pointPair5.Second;
			xyz3 += xyz2 * this.drawFpData.DisB;
			pointPair5.Second = xyz3;
			this.m_aryLinePtsRight[this.m_aryLinePtsRight.Count - 1] = pointPair5;
			PointPair ppBefore = this.m_aryLinePtsLeft.Last<PointPair>();
			this.MakeArcByPPArray(this.m_aryLinePtsLeft, this.drawFpData.DisRadius);
			this.MakeArcByPPArray(this.m_aryLinePtsRight, this.drawFpData.DisRadius);
			pointPair5.DoExchange();
			this.MakeArcPair(ppBefore, pointPair5, this.drawFpData.DisRadius);
		}

		private void _Connect_SHZ()
		{
			int count = this.m_aryLinePtsLeft.Count;
			if (count < 4)
			{
				return;
			}
			double num = this.m_dHeight / (this.drawFpData.DisD + this.drawFpData.DisB);
			double num2 = this.m_dWidth / (this.drawFpData.DisA + this.drawFpData.DisC);
			if (num >= num2)
			{
				PointPair pointPair = this.m_aryLinePtsLeft.First<PointPair>();
				PointPair pointPair2 = this.m_aryLinePtsLeft[count - 2];
				pointPair.Retract(-0.098425196850393692, 0.0);
				XYZ s = pointPair.First + this.m_vWidth * this.drawFpData.DisA;
				double num3 = this.m_aryLinePtsLeft[count - 4].DistanceTo(this.m_aryLinePtsLeft[count - 6]);
				double length = this.m_aryLinePtsLeft[count - 3].GetLength();
				this.m_aryLinePtsLeft[count - 3].Retract(0.0, length + 2.0 * this.drawFpData.DisRadius - num3 * 0.5);
				pointPair2.Offset(-this.m_vWidth * (length + 2.0 * this.drawFpData.DisRadius - num3 * 0.5));
				PointPair pointPair3 = new PointPair(pointPair2.Second, s, true, false);
				if (this.drawFpData.DisRadius > 0.0)
				{
					this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
					this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
					this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
					ArcPtPair arcPtPair = new ArcPtPair();
					ArcPtPair arcPtPair2 = new ArcPtPair();
					arcPtPair.ReInitByTwoOrderPerPair(this.m_aryLinePtsLeft[count - 3], pointPair2, this.drawFpData.DisRadius, false);
					arcPtPair2.ReInitByTwoPerPair(pointPair2, pointPair3, this.drawFpData.DisRadius, false);
					pointPair2.Second = arcPtPair2.Start;
					pointPair3.First = arcPtPair2.End;
					this.m_aryArcPtsIn.Add(arcPtPair);
					this.m_aryArcPtsIn.Add(arcPtPair2);
				}
				this.m_aryLinePtsLeft.Remove(this.m_aryLinePtsLeft.Last<PointPair>());
				pointPair3.DoExchange();
				this.m_aryLinePtsLeft.Add(pointPair3);
				return;
			}
			PointPair pointPair4 = this.m_aryLinePtsLeft.First<PointPair>();
			PointPair pointPair5 = this.m_aryLinePtsLeft.Last<PointPair>();
			pointPair4.Retract(-0.098425196850393692, 0.0);
			XYZ s2 = pointPair4.First + this.m_vWidth * this.drawFpData.DisA;
			double num4 = this.m_aryLinePtsLeft[count - 3].DistanceTo(this.m_aryLinePtsLeft[count - 5]);
			double length2 = this.m_aryLinePtsLeft[count - 2].GetLength();
			this.m_aryLinePtsLeft[count - 2].Retract(0.0, length2 + 2.0 * this.drawFpData.DisRadius - num4 * 0.5);
			pointPair5.Offset(-this.m_vHeight * (length2 + 2.0 * this.drawFpData.DisRadius - num4 * 0.5));
			PointPair pointPair6 = new PointPair(pointPair5.Second, s2, true, false);
			if (this.drawFpData.DisRadius > 0.0)
			{
				this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
				this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
				ArcPtPair arcPtPair3 = new ArcPtPair();
				ArcPtPair arcPtPair4 = new ArcPtPair();
				arcPtPair3.ReInitByTwoOrderPerPair(this.m_aryLinePtsLeft[count - 2], pointPair5, this.drawFpData.DisRadius, false);
				arcPtPair4.ReInitByTwoPerPair(pointPair5, pointPair6, this.drawFpData.DisRadius, false);
				pointPair5.Second = arcPtPair4.Start;
				pointPair6.First = arcPtPair4.End;
				this.m_aryArcPtsIn.Add(arcPtPair3);
				this.m_aryArcPtsIn.Add(arcPtPair4);
			}
			pointPair6.DoExchange();
			this.m_aryLinePtsLeft.Add(pointPair6);
		}

		private void _Connect_HZ()
		{
			int count = this.m_aryLinePtsRight.Count;
			int count2 = this.m_aryLinePtsLeft.Count;
			if (count < 4 && count2 < 4)
			{
				return;
			}
			PointPair pointPair = new PointPair();
			PointPair pointPair2 = new PointPair();
			PointPair pointPair3 = new PointPair();
			PointPair pointPair4 = new PointPair();
			bool flag;
			if (count2 > count)
			{
				pointPair = this.m_aryLinePtsLeft[count2 - 4];
				pointPair2 = this.m_aryLinePtsLeft[count2 - 3];
				pointPair3 = this.m_aryLinePtsLeft[count2 - 2];
				pointPair4 = this.m_aryLinePtsLeft[count2 - 1];
				flag = true;
			}
			else
			{
				pointPair = this.m_aryLinePtsRight[count - 4];
				pointPair2 = this.m_aryLinePtsRight[count - 3];
				pointPair3 = this.m_aryLinePtsRight[count - 2];
				pointPair4 = this.m_aryLinePtsRight[count - 1];
				flag = false;
			}
			if (count2 < 5 && count == 0)
			{
				pointPair = new PointPair(pointPair.First, pointPair.Second, !pointPair.IsIn, pointPair.IsLoopFirst);
				pointPair2 = new PointPair(pointPair2.First, pointPair2.Second, !pointPair2.IsIn, pointPair2.IsLoopFirst);
				pointPair3 = new PointPair(pointPair3.First, pointPair3.Second, !pointPair3.IsIn, pointPair3.IsLoopFirst);
				pointPair4 = new PointPair(pointPair4.First, pointPair4.Second, !pointPair4.IsIn, pointPair4.IsLoopFirst);
				bool flag2 = pointPair2.GetLength() > this.drawFpData.DisA + this.drawFpData.DisC;
				if (pointPair2.DistanceTo(pointPair4) > this.drawFpData.DisB && flag2)
				{
					PointPair pointPair5 = new PointPair(pointPair.First, pointPair.Second, !pointPair.IsIn, pointPair.IsLoopFirst);
					PointPair pointPair6 = new PointPair(pointPair2.First, pointPair2.Second, !pointPair2.IsIn, pointPair2.IsLoopFirst);
					PointPair pointPair7 = new PointPair(pointPair3.First, pointPair3.Second, !pointPair3.IsIn, pointPair3.IsLoopFirst);
					PointPair pointPair8 = new PointPair(pointPair4.First, pointPair4.Second, !pointPair4.IsIn, pointPair4.IsLoopFirst);
					pointPair5.Retract(0.0, this.drawFpData.DisB);
					pointPair5.Offset(this.drawFpData.DisA * this.m_vWidth);
					pointPair6.Offset(this.drawFpData.DisB * this.m_vHeight);
					pointPair6.Retract(this.drawFpData.DisA, this.drawFpData.DisC);
					if (pointPair5.GetLength() > this.drawFpData.DisD && pointPair6.GetLength() > this.drawFpData.DisC)
					{
						pointPair7.Retract(this.drawFpData.DisB, this.drawFpData.DisD);
						pointPair7.Offset(-this.m_vWidth * this.drawFpData.DisC);
						pointPair8.Retract(this.drawFpData.DisC, 0.0);
						pointPair8.Offset(-this.m_vHeight * this.drawFpData.DisD);
						PointPair pointPair9 = new PointPair(pointPair8.Second, pointPair4.Second, false, false);
						if (this.drawFpData.DisRadius > 0.0)
						{
							ArcPtPair arcPtPair = new ArcPtPair();
							ArcPtPair arcPtPair2 = new ArcPtPair();
							ArcPtPair arcPtPair3 = new ArcPtPair();
							ArcPtPair arcPtPair4 = new ArcPtPair();
							ArcPtPair arcPtPair5 = new ArcPtPair();
							double num = pointPair5.DistanceTo(pointPair7);
							double num2 = (this.drawFpData.DisRadius < num * 0.5) ? this.drawFpData.DisRadius : (num * 0.5);
							arcPtPair.ReInitByTwoOrderPerPair(pointPair5, pointPair6, num2, false);
							double num3 = pointPair6.DistanceTo(pointPair8);
							double num4 = (this.drawFpData.DisRadius < num3 * 0.5) ? this.drawFpData.DisRadius : (num3 * 0.5);
							arcPtPair2.ReInitByTwoOrderPerPair(pointPair6, pointPair7, (num4 < num2) ? num4 : num2, false);
							double num5 = pointPair7.DistanceTo(pointPair9);
							double num6 = (this.drawFpData.DisRadius < num5 * 0.5) ? this.drawFpData.DisRadius : (num5 * 0.5);
							arcPtPair3.ReInitByTwoOrderPerPair(pointPair7, pointPair8, (num6 < num4) ? num6 : num4, false);
							double num7 = pointPair8.DistanceTo(pointPair4);
							double num8 = (this.drawFpData.DisRadius < num7 * 0.5) ? this.drawFpData.DisRadius : (num7 * 0.5);
							arcPtPair4.ReInitByTwoOrderPerPair(pointPair8, pointPair9, (num8 < num6) ? num8 : num6, false);
							pointPair9.DoExchange();
							arcPtPair5.ReInitByTwoOrderPerPair(pointPair4, pointPair9, num8, false);
							pointPair5.Second = arcPtPair.Start;
							pointPair6.First = arcPtPair.End;
							pointPair6.Second = arcPtPair2.Start;
							pointPair7.First = arcPtPair2.End;
							pointPair7.Second = arcPtPair3.Start;
							pointPair8.First = arcPtPair3.End;
							pointPair8.Second = arcPtPair4.Start;
							pointPair9.Second = arcPtPair4.End;
							pointPair9.First = arcPtPair5.End;
							pointPair4.Second = arcPtPair5.Start;
							this.m_aryArcPtsOut.AddRange(new ArcPtPair[]
							{
								arcPtPair,
								arcPtPair2,
								arcPtPair3,
								arcPtPair4,
								arcPtPair5
							});
						}
						this.m_aryLinePtsRight.AddRange(new PointPair[]
						{
							pointPair5,
							pointPair6,
							pointPair7,
							pointPair8,
							pointPair9
						});
						return;
					}
					double num9 = pointPair5.DistanceTo(pointPair3);
					double length = pointPair6.GetLength();
					pointPair6.Retract(0.0, num9 + this.drawFpData.DisRadius - length * 0.5);
					XYZ project = pointPair4.GetProject(pointPair6.Second);
					pointPair7.First = pointPair6.Second;
					pointPair7.Second = project;
					pointPair4.Second = project;
					if (this.drawFpData.DisRadius > 0.0)
					{
						ArcPtPair arcPtPair6 = new ArcPtPair();
						ArcPtPair arcPtPair7 = new ArcPtPair();
						ArcPtPair arcPtPair8 = new ArcPtPair();
						arcPtPair6.ReInitByTwoOrderPerPair(pointPair5, pointPair6, this.drawFpData.DisRadius, false);
						arcPtPair7.ReInitByTwoOrderPerPair(pointPair6, pointPair7, this.drawFpData.DisRadius, false);
						pointPair4.DoExchange();
						arcPtPair8.ReInitByTwoOrderPerPair(pointPair7, pointPair4, this.drawFpData.DisRadius, false);
						pointPair5.Second = arcPtPair6.Start;
						pointPair6.First = arcPtPair6.End;
						pointPair6.Second = arcPtPair7.Start;
						pointPair7.First = arcPtPair7.End;
						pointPair7.Second = arcPtPair8.Start;
						pointPair4.First = arcPtPair8.End;
						this.m_aryArcPtsOut.AddRange(new ArcPtPair[]
						{
							arcPtPair6,
							arcPtPair7,
							arcPtPair8
						});
					}
					this.m_aryLinePtsRight.AddRange(new PointPair[]
					{
						pointPair5,
						pointPair6,
						pointPair7
					});
					return;
				}
				else
				{
					XYZ second = pointPair.First + this.m_vWidth * this.drawFpData.DisA;
					pointPair4.Second = second;
					pointPair4.IsIn = !pointPair4.IsIn;
					if (this.drawFpData.DisRadius > 0.0)
					{
						this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
						return;
					}
				}
			}
			else
			{
				double num10 = this.m_dHeight / (this.drawFpData.DisD + this.drawFpData.DisB);
				double num11 = this.m_dWidth / (this.drawFpData.DisA + this.drawFpData.DisC);
				if (num10 >= num11)
				{
					if (this.drawFpData.DisRadius > 0.0)
					{
						this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
						this.m_aryArcPtsOut.Remove(this.m_aryArcPtsOut.Last<ArcPtPair>());
						if (flag)
						{
							this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
							this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
							this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
						}
						else
						{
							this.m_aryArcPtsOut.Remove(this.m_aryArcPtsOut.Last<ArcPtPair>());
							this.m_aryArcPtsOut.Remove(this.m_aryArcPtsOut.Last<ArcPtPair>());
							this.m_aryArcPtsOut.Remove(this.m_aryArcPtsOut.Last<ArcPtPair>());
						}
					}
					PointPair pointPair10 = new PointPair();
					PointPair ppOther = new PointPair();
					if (!flag)
					{
						this.m_aryLinePtsRight.Remove(pointPair4);
						pointPair10 = this.m_aryLinePtsLeft[count2 - 1];
						ppOther = this.m_aryLinePtsLeft[count2 - 2];
					}
					else
					{
						this.m_aryLinePtsLeft.Remove(pointPair4);
						pointPair10 = this.m_aryLinePtsRight[count - 1];
						ppOther = this.m_aryLinePtsRight[count - 2];
					}
					double num12 = pointPair.DistanceTo(ppOther);
					double length2 = pointPair2.GetLength();
					pointPair2.Retract(0.0, 2.0 * this.drawFpData.DisRadius + length2 - num12 * 0.5);
					if (2.0 * this.drawFpData.DisRadius + length2 - num12 * 0.5 > length2)
					{
						pointPair2.DoExchange();
					}
					pointPair3.Offset(-this.m_vWidth * (2.0 * this.drawFpData.DisRadius + length2 - num12 * 0.5));
					XYZ project2 = pointPair10.GetProject(pointPair3.Second);
					pointPair3.Second = project2;
					pointPair10.Second = project2;
					if (this.drawFpData.DisRadius > 0.0)
					{
						double dRadius = (this.drawFpData.DisRadius < num12 * 0.25) ? this.drawFpData.DisRadius : (num12 * 0.23);
						ArcPtPair arcPtPair9 = new ArcPtPair();
						ArcPtPair arcPtPair10 = new ArcPtPair();
						ArcPtPair arcPtPair11 = new ArcPtPair();
						arcPtPair11.ReInitByTwoOrderPerPair(pointPair, pointPair2, dRadius, false);
						pointPair.Second = arcPtPair11.Start;
						pointPair2.First = arcPtPair11.End;
						arcPtPair9.ReInitByTwoOrderPerPair(pointPair2, pointPair3, dRadius, false);
						pointPair2.Second = arcPtPair9.Start;
						pointPair3.First = arcPtPair9.End;
						pointPair3.DoExchange();
						arcPtPair10.ReInitByTwoOrderPerPair(pointPair10, pointPair3, dRadius, false);
						pointPair3.First = arcPtPair10.End;
						pointPair10.Second = arcPtPair10.Start;
						if (flag)
						{
							this.m_aryArcPtsIn.AddRange(new ArcPtPair[]
							{
								arcPtPair9,
								arcPtPair11
							});
							this.m_aryArcPtsOut.Add(arcPtPair10);
							return;
						}
						this.m_aryArcPtsIn.Add(arcPtPair10);
						this.m_aryArcPtsOut.AddRange(new ArcPtPair[]
						{
							arcPtPair9,
							arcPtPair11
						});
						return;
					}
				}
				else
				{
					if (this.drawFpData.DisRadius > 0.0)
					{
						if (flag)
						{
							this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
							this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
							this.m_aryArcPtsIn.Remove(this.m_aryArcPtsIn.Last<ArcPtPair>());
						}
						else
						{
							this.m_aryArcPtsOut.Remove(this.m_aryArcPtsOut.Last<ArcPtPair>());
							this.m_aryArcPtsOut.Remove(this.m_aryArcPtsOut.Last<ArcPtPair>());
							this.m_aryArcPtsOut.Remove(this.m_aryArcPtsOut.Last<ArcPtPair>());
						}
					}
					PointPair pointPair11 = new PointPair();
					if (flag)
					{
						pointPair11 = this.m_aryLinePtsRight[count - 1];
					}
					else
					{
						pointPair11 = this.m_aryLinePtsLeft[count2 - 1];
					}
					double num13 = pointPair2.DistanceTo(pointPair11);
					double length3 = pointPair3.GetLength();
					pointPair3.Retract(0.0, 2.0 * this.drawFpData.DisRadius + length3 - num13 * 0.5);
					if (2.0 * this.drawFpData.DisRadius + length3 - num13 * 0.5 > length3)
					{
						pointPair3.DoExchange();
					}
					pointPair4.Offset(-this.m_vHeight * (2.0 * this.drawFpData.DisRadius + length3 - num13 * 0.5));
					if (this.drawFpData.DisRadius > 0.0)
					{
						PointPair pointPair12;
						if (flag)
						{
							XYZ project3 = pointPair4.GetProject(this.m_aryArcPtsOut.Last<ArcPtPair>().End);
							pointPair4.Second = project3;
							pointPair12 = new PointPair(this.m_aryArcPtsOut.Last<ArcPtPair>().End, project3, pointPair11.IsIn, false);
						}
						else
						{
							XYZ project4 = pointPair4.GetProject(this.m_aryArcPtsIn.Last<ArcPtPair>().End);
							pointPair4.Second = project4;
							pointPair12 = new PointPair(this.m_aryArcPtsIn.Last<ArcPtPair>().End, project4, pointPair11.IsIn, false);
						}
						double dRadius2 = (this.drawFpData.DisRadius < num13 * 0.25) ? this.drawFpData.DisRadius : (num13 * 0.23);
						ArcPtPair arcPtPair12 = new ArcPtPair();
						ArcPtPair arcPtPair13 = new ArcPtPair();
						ArcPtPair arcPtPair14 = new ArcPtPair();
						arcPtPair14.ReInitByTwoOrderPerPair(pointPair2, pointPair3, dRadius2, false);
						pointPair2.Second = arcPtPair14.Start;
						pointPair3.First = arcPtPair14.End;
						arcPtPair12.ReInitByTwoOrderPerPair(pointPair3, pointPair4, dRadius2, false);
						pointPair3.Second = arcPtPair12.Start;
						pointPair4.First = arcPtPair12.End;
						pointPair4.DoExchange();
						arcPtPair13.ReInitByTwoOrderPerPair(pointPair12, pointPair4, dRadius2, false);
						pointPair4.First = arcPtPair13.End;
						pointPair12.Second = arcPtPair13.Start;
						if (flag)
						{
							this.m_aryArcPtsIn.AddRange(new ArcPtPair[]
							{
								arcPtPair12,
								arcPtPair14
							});
							this.m_aryArcPtsOut.Add(arcPtPair13);
						}
						else
						{
							this.m_aryArcPtsIn.Add(arcPtPair13);
							this.m_aryArcPtsOut.AddRange(new ArcPtPair[]
							{
								arcPtPair12,
								arcPtPair14
							});
						}
						this.m_aryLinePtsRight.Add(pointPair12);
						return;
					}
					XYZ project5 = pointPair4.GetProject(pointPair11.Second);
					pointPair4.Second = project5;
					PointPair item = new PointPair(pointPair11.Second, project5, pointPair11.IsIn, false);
					this.m_aryLinePtsRight.Add(item);
				}
			}
		}

		public void MakeArcByPPArray(List<PointPair> arr, double dRadius)
		{
			for (int i = 1; i < arr.Count; i++)
			{
				PointPair ppBefore = arr[i - 1];
				PointPair ppNext = arr[i];
				this.MakeArcPair(ppBefore, ppNext, dRadius);
			}
		}

		public void MakeArcPair(PointPair ppBefore, PointPair ppNext, double dRadius)
		{
			XYZ first = ppBefore.First;
			XYZ second = ppBefore.Second;
			XYZ first2 = ppNext.First;
			XYZ second2 = ppNext.Second;
			XYZ xyz = (second - first).Normalize();
			(second2 - first2).Normalize();
			XYZ xyz2 = (first2 - second).Normalize();
			dRadius = Math.Min(dRadius, first2.DistanceTo(second) / 2.0);
			XYZ xyz3 = second + xyz2 * dRadius;
			XYZ xyz4 = xyz3 + dRadius * xyz;
			XYZ xyz5 = (xyz - xyz2).Normalize();
			XYZ m = xyz3 + dRadius * xyz5;
			this.m_aryArcPts.Add(new ArcPtPair(second, m, xyz4, ppBefore.IsIn, false));
			XYZ xyz6 = first2 - xyz2 * dRadius;
			XYZ xyz7 = xyz6 + dRadius * xyz;
			XYZ xyz8 = (xyz + xyz2).Normalize();
			XYZ m2 = xyz6 + dRadius * xyz8;
			this.m_aryArcPts.Add(new ArcPtPair(first2, m2, xyz7, ppNext.IsIn, false));
			if (!xyz4.IsAlmostEqualTo(xyz7))
			{
				this.m_aryLinePtsTop.Add(new PointPair(xyz4, xyz7, ppBefore.IsIn, false));
			}
		}

		private void _DealWidth(List<PointPair> ary, List<ArcPtPair> aryArcPts, bool IsSHZ = false)
		{
			int count = ary.Count;
			int count2 = aryArcPts.Count;
			if (count >= 4)
			{
				if (!ary[0].IsIn)
				{
					ary[0].Retract(-this.drawFpData.DisD, 0.0);
				}
				for (int i = 1; i < count; i++)
				{
					if (i % 4 == 0)
					{
						if (IsSHZ)
						{
							ary[i].Retract(-(this.drawFpData.DisD - this.drawFpData.DisRadius), 0.0);
						}
						else
						{
							ary[i].Retract(-(2.0 * this.drawFpData.DisD - this.drawFpData.DisRadius), 0.0);
						}
					}
				}
			}
		}

		private void _DealWidth(List<RevolvingEdge> aryEdges, List<PointPair> ary, List<ArcPtPair> aryArcPts)
		{
			int count = aryEdges.Count;
			if (count < 1)
			{
				aryEdges.Clear();
				ary.Clear();
				aryArcPts.Clear();
				return;
			}
			aryEdges[0].AppendPointPairToArray(ref ary, ref aryArcPts);
			for (int i = 1; i < count; i++)
			{
				RevolvingEdge revolvingEdge = aryEdges[i - 1];
				RevolvingEdge revolvingEdge2 = aryEdges[i];
				PointPair pointPair_A = revolvingEdge2.GetPointPair_A();
				ArcPtPair arcPair_DA = revolvingEdge.GetArcPair_DA();
				pointPair_A.First = arcPair_DA.End;
				revolvingEdge2.SetPointPair_A(pointPair_A);
				revolvingEdge2.AppendPointPairToArray(ref ary, ref aryArcPts);
			}
			aryEdges.Clear();
		}

		public void CreateCurves()
		{
			this.m_aryLines.Clear();
			this._CreateLinesByPairArray(this.m_aryLinePtsLeft);
			this._CreateLinesByPairArray(this.m_aryLinePtsTop);
			this._CreateLinesByPairArray(this.m_aryLinePtsRight);
			this._CreateLinesByPairArray(this.m_aryLinePtsBot);
			this.m_aryArcs.Clear();
			if (this.drawFpData.DisRadius < 0.0032808398950131233)
			{
				return;
			}
			this._CreateArcs(this.m_aryArcPts);
			this._CreateArcs(this.m_aryArcPtsIn);
			this._CreateArcs(this.m_aryArcPtsOut);
		}

		private void _CreateLinesByPairArray(List<PointPair> arr)
		{
			if (this.m_aryCurvesIn == null)
			{
				this.m_aryCurvesIn = new List<Curve>();
			}
			if (this.m_aryCurvesOut == null)
			{
				this.m_aryCurvesOut = new List<Curve>();
			}
			for (int i = 0; i < arr.Count; i++)
			{
				if (!(arr[i].CreateLine() == null))
				{
					Line line = arr[i].CreateLine();
					Curve item = line;
					if (arr[i].IsIn)
					{
						this.m_aryCurvesIn.Add(item);
					}
					else
					{
						this.m_aryCurvesOut.Add(item);
					}
					this.m_aryLines.Add(line);
				}
			}
		}

		private void _CreateArcs(List<ArcPtPair> ary)
		{
			for (int i = 0; i < ary.Count; i++)
			{
				Arc arc = ary[i].CreateArc();
				Curve item = arc;
				if (ary[i].IsIn)
				{
					this.m_aryCurvesIn.Add(item);
				}
				else
				{
					this.m_aryCurvesOut.Insert(1, item);
				}
				this.m_aryArcs.Add(arc);
			}
		}

		private XYZ CalcMoveDirection(PointPair pp)
		{
			double num = this.m_dWidth - pp.DistanceTo(this.m_ptTL);
			return this.m_vWidth * ((this.drawFpData.DisToWall + num) * 0.5 - this.drawFpData.DisToWall);
		}

		private XYZ m_ptBL;

		private XYZ m_ptTL;

		private XYZ m_vWidth;

		private XYZ m_vHeight;

		private double m_dWidth;

		private double m_dHeight;

		private List<Line> m_aryLines;

		private List<Arc> m_aryArcs;

		private List<ArcPtPair> m_aryArcPts;

		private List<ArcPtPair> m_aryArcPtsIn;

		private List<ArcPtPair> m_aryArcPtsOut;

		private List<PointPair> m_aryLinePtsLeft;

		private List<PointPair> m_aryLinePtsRight;

		private List<PointPair> m_aryLinePtsTop;

		private List<PointPair> m_aryLinePtsBot;

		private DrawFloorPipeData drawFpData;

		public List<Curve> m_aryCurvesIn;

		public List<Curve> m_aryCurvesOut;
	}
}
